var DataTypes = require("sequelize").DataTypes;
var _articles = require("./articles");
var _classification_table = require("./classification_table");
var _parent_comments = require("./parent_comments");
var _sequelizemeta = require("./sequelizemeta");
var _sub_comments = require("./sub_comments");
var _users = require("./users");

function initModels(sequelize) {
  var articles = _articles(sequelize, DataTypes);
  var classification_table = _classification_table(sequelize, DataTypes);
  var parent_comments = _parent_comments(sequelize, DataTypes);
  var sequelizemeta = _sequelizemeta(sequelize, DataTypes);
  var sub_comments = _sub_comments(sequelize, DataTypes);
  var users = _users(sequelize, DataTypes);

  sub_comments.belongsTo(parent_comments, { as: "reviewer", foreignKey: "reviewers_id"});
  parent_comments.hasMany(sub_comments, { as: "sub_comments", foreignKey: "reviewers_id"});

  return {
    articles,
    classification_table,
    parent_comments,
    sequelizemeta,
    sub_comments,
    users,
  };
}
module.exports = initModels;
module.exports.initModels = initModels;
module.exports.default = initModels;
